
#ifndef __VFS_LFS_H__
#define __VFS_LFS_H__

#include "os.h"
#include "lfs.h"
#include "flash.h"

typedef struct {
    OS_MUTEX mutex;
    int start_addr;
    int end_addr;
} lfs_cfg_ctx_t;

typedef struct {
    lfs_t lfs;
    lfs_cfg_ctx_t cfg_ctx;
    struct lfs_config cfg;
} lfs_object_t;

#define LFS_OPEN_FLAGS_R        (LFS_O_RDONLY)
#define LFS_OPEN_FLAGS_W        (LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC)
#define LFS_OPEN_FLAGS_A        (LFS_O_WRONLY | LFS_O_CREAT | LFS_O_APPEND)
#define LFS_OPEN_FLAGS_RPluse   (LFS_O_RDWR)
#define LFS_OPEN_FLAGS_WPluse   (LFS_O_RDWR | LFS_O_CREAT | LFS_O_TRUNC)
#define LFS_OPEN_FLAGS_APluse   (LFS_O_RDWR | LFS_O_CREAT | LFS_O_APPEND)

extern int vfs_lfs_init(lfs_object_t *object, char *name);

#endif
